#pragma once
#include <Rz/Types.h>

#ifdef RZ_DEBUG
#	include <cstdio>
#	ifdef RZ_OS_WINDOWS
#		include <crtdbg.h>
#		define RZ_BREAK_IF(expr)		{ if(expr) _CrtDbgBreak(); }
#	else
#		include <cassert>
#		define RZ_BREAK_IF(expr)		{ assert(!(expr)); }
#	endif
#	define RZ_DEBUG_PRINT(f, ...)		{ printf(f, __VA_ARGS__); }
#else
#	define RZ_BREAK_IF(expr)
#	define RZ_DEBUG_PRINT(f, ...)
#endif

#ifdef RZ_OS_WINDOWS
#	define _RZ_INVOKE_ASSERT(msg)	MessageBoxA(NULL, l_sMessage, "Exception", MB_ICONWARNING | MB_OK)
#else
#	define _RZ_INVOKE_ASSERT(msg)	puts(msg)
#endif

#ifdef RZ_INCLUDE_ASSERT
#	define RZ_ASSERT(expr, ...)\
		::Rz::Diagnostics::__Assert(!!(expr), __FILE__, __LINE__, __FUNCTION__, (#expr), __VA_ARGS__ + 0);\
		RZ_BREAK_IF(!(expr))
#else
#	define RZ_ASSERT(expr, ...) (void)(0)
#endif

namespace Rz { namespace Diagnostics {

void __Assert(int expression, const char* filename, int line, const char* fn, const char* expr, const char* msg = nullptr);

} }
